public class hw9 {
    public static void main(String[] args) {
        int num=0;
        for (int i=1;i<=100;i++){
            if (i%2!=0&&i%3!=0&&i%5!=0&&i%7!=0){
                System.out.print(i+" ");
                num++;
                if (num%8==0){
                    System.out.println();
                }
            }
        }
        System.out.println("\n100以内有"+num+"个质数");
    }
}
